package com.google.code.timetrail.tests;

import com.google.code.timetrail.backend.Control;
import com.google.code.timetrail.backend.Doctor;
import com.google.code.timetrail.backend.Engineer;
import com.google.code.timetrail.backend.Entrepreneur;
import com.google.code.timetrail.backend.Inventory;
import com.google.code.timetrail.backend.Nutritionist;
import com.google.code.timetrail.backend.Person;
import junit.framework.TestCase;

/**
 * The class <code>PersonTest</code> contains tests for the class {@link
 * <code>Person</code>}
 * @author Apurv Jain
 *
 * @version $Revision$
 */
public class PersonTest extends TestCase {
	
	private Person personTested;
	private Doctor doctorTested;
	private Nutritionist nutritionistTested;
	private Engineer engineerTested;
	private Entrepreneur entrepreneurTested;
	
	private Inventory invPerson;
	private Inventory invDoctor;
	private Inventory invNutri;
	private Inventory invEngi;
	private Inventory invEntre;
	
	/**
	 * Perform pre-test initialization
	 *
	 * @throws Exception
	 *
	 * @see TestCase#setUp()
	 */
	protected void setUp() throws Exception {
		//controller=new Control();
		personTested=new Person("testCase1");
		doctorTested= new Doctor();
		nutritionistTested= new Nutritionist();
		engineerTested= new Engineer();
		entrepreneurTested= new Entrepreneur();
		invPerson=new Inventory();
		invDoctor=new Inventory();
		invNutri=new Inventory();
		invEngi=new Inventory();
		invEntre=new Inventory();
	}

	/**
	 * Run the void initialBonus(Inventory) method test
	 */
	public void testInitialBonus() {
		personTested.initialBonus(invPerson);
		assertEquals("Does not set the initial money for Person correctly",800,invPerson.getMoney().getCurrentAmount());
		assertEquals("Does not set the initial food for Person correctly",0,invPerson.getFood().getCurrentAmount());
		assertEquals("Does not set the initial fuel cells for Person correctly",0,invPerson.getFuelCells().getCurrentAmount());
		assertEquals("Does not set the initial fuel capacitors for Person correctly",0,invPerson.getFCapacitors().getCurrentAmount());
		assertEquals("Does not set the initial hull parts for Person correctly",0,invPerson.getHullParts().getCurrentAmount());

		doctorTested.initialBonus(invDoctor);
		assertEquals("Does not set the initial money for Doctor correctly",800,invDoctor.getMoney().getCurrentAmount());
		assertEquals("Does not set the initial food for Doctor correctly",0,invDoctor.getFood().getCurrentAmount());
		assertEquals("Does not set the initial fuel cells for Doctor correctly",0,invDoctor.getFuelCells().getCurrentAmount());
		assertEquals("Does not set the initial fuel capacitors for Doctor correctly",0,invDoctor.getFCapacitors().getCurrentAmount());
		assertEquals("Does not set the initial hull parts for Person Doctor",0,invDoctor.getHullParts().getCurrentAmount());
		
		nutritionistTested.initialBonus(invNutri);
		assertEquals("Does not set the initial money for Nutritionist correctly",400,invNutri.getMoney().getCurrentAmount());
		assertEquals("Does not set the initial food for Nutritionist correctly",0,invNutri.getFood().getCurrentAmount());
		assertEquals("Does not set the initial fuel cells for Nutritionist correctly",0,invNutri.getFuelCells().getCurrentAmount());
		assertEquals("Does not set the initial fuel capacitors for Nutritionist correctly",0,invNutri.getFCapacitors().getCurrentAmount());
		assertEquals("Does not set the initial hull parts for Nutritionist correctly",0,invNutri.getHullParts().getCurrentAmount());
		
		engineerTested.initialBonus(invEngi);
		assertEquals("Does not set the initial money for Engineer correctly",800,invEngi.getMoney().getCurrentAmount());
		assertEquals("Does not set the initial food for Engineer correctly",0,invEngi.getFood().getCurrentAmount());
		assertEquals("Does not set the initial fuel cells for Engineer correctly",0,invEngi.getFuelCells().getCurrentAmount());
		assertEquals("Does not set the initial fuel capacitors for Engineer correctly",0,invEngi.getFCapacitors().getCurrentAmount());
		assertEquals("Does not set the initial hull parts for Engineer correctly",0,invEngi.getHullParts().getCurrentAmount());
		
		entrepreneurTested.initialBonus(invEntre);
		assertEquals("Does not set the initial money for Entrepreneur correctly",1600,invEntre.getMoney().getCurrentAmount());
		assertEquals("Does not set the initial food for Entrepreneur correctly",0,invEntre.getFood().getCurrentAmount());
		assertEquals("Does not set the initial fuel cells for Entrepreneur correctly",0,invEntre.getFuelCells().getCurrentAmount());
		assertEquals("Does not set the initial fuel capacitors for Entrepreneur correctly",0,invEntre.getFCapacitors().getCurrentAmount());
		assertEquals("Does not set the initial hull parts for Entrepreneur correctly",0,invEntre.getHullParts().getCurrentAmount());
		
	}
}

/*$CPS$ This comment was generated by CodePro. Do not edit it.
 * patternId = com.instantiations.assist.eclipse.pattern.testCasePattern
 * strategyId = com.instantiations.assist.eclipse.pattern.testCasePattern.junitTestCase
 * additionalTestNames = 
 * assertTrue = false
 * callTestMethod = true
 * createMain = true
 * createSetUp = true
 * createTearDown = false
 * createTestFixture = false
 * createTestStubs = false
 * methods = die(),heal(),initialBonus(QInventory;),isAlive(),isDead(),isSick(),sick()
 * package = com.google.code.timetrail.tests
 * package.sourceFolder = timeTrail/src
 * superclassType = junit.framework.TestCase
 * testCase = PersonTest
 * testClassType = com.google.code.timetrail.backend.Person
 */